package com.travel.controller.user;

import com.travel.entity.po.Carousel;
import com.travel.result.Result;
import com.travel.service.CarouselService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/carousels")
@Validated
public class UserCarouselController {

    private final CarouselService carouselService;

    public UserCarouselController(CarouselService carouselService) {
        this.carouselService = carouselService;
    }

    @GetMapping
    public Result<List<Carousel>> getActiveCarousels() {
        return Result.success(carouselService.getActiveCarousels());
    }

    public List<Carousel> getAllCarousels() {
        return carouselService.getAllCarousels();
    }
}